home *** CD-ROM | disk | FTP | other *** search
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
- /* */
- /* Prototype HP15C Calculator */
- /* James C. Ullrey */
- /* INRESCO */
- /* © 1990 */
- /* Version 13.97a */
- /* */
- /* ACTIVATE SEGMENT */
- /* */
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
-
-
-
-
- /*****************************************************************/
- /* I N C L U D E S
- /*****************************************************************/
-
- #ifndef __C14__
- #ifndef __C14__
- #include "PredatorPrey.h"
- #endif
- #endif
- #include "windows.h"
- #include "calc_activate.h"
- #include "Globals.h"
- #include "HelpWindowProc.h"
- #include "MainMenu.h"
-
- /********************************************************************
- /* G L O B A L V A R I A B L E D E C L A R A T I O N S
- /********************************************************************/
- extern Rect gPalette_frame;
- extern Rect gRotation_frame;
- extern Rect gStretch_frame;
- extern Rect gDoManyRotation_box;
- extern Rect gMovement_frame;
- extern Rect gPlaneControl_frame;
-
- /*****************************************************************/
- /* P R O T O T Y P E S
- /*****************************************************************/
-
-
- //extern short one_of_mine (WindowPtr wPtr);
-
- /*extern void draw_palette (WindowPtr wPtr);*/
-
- //extern void inval_object (WindowPtr wPtr, short index);
- extern Boolean DoActivateDeactivate (WindowPtr whichWindow,char adFlag);
-
-
- /*****************************************************************/
- /*****************************************************************/
- /*
- /* R O U T I N E S
- /*
- /*****************************************************************/
- /*****************************************************************/
-
-
- void activate_seg() {} /* for reference in "UnloadSeg()" calls */
-
-
-
- /*****************************************************************/
- /* D O A C T I V A T E - activate and deactivate windows
- /*****************************************************************/
-
- /**
- When the system sends an activate event, this routine hides
- the controls and draws the grow icon in the case of a deactivation,
- and, in the case of an activation, draws the controls. The message
- field of the event record, a long, is cast to a WindowPtr, which
- identifies the window. The modifiers field is masked to determine
- if it is an activate or deactivate event.
- **/
-
-
- void do_activate(WindowPtr wPtr,Boolean is_activate)
- {
- short index;
- WObjsHandle w_objs_hndl;
- ControlHandle h_ctl_hndl;
- ControlHandle v_ctl_hndl;
- Rect bounds;
- long dummy;
-
- if(one_of_mine(wPtr))
- {
- SetPort(wPtr);
-
- w_objs_hndl = (WObjsHandle)GetWRefCon(wPtr);
-
- if(w_objs_hndl != NIL)
- {
- for(index = 0; index < MAX_OBJECTS; index++) /* MAX_OBJECTS happens to be 30 */
- if((**w_objs_hndl).object[index].selected)
- inval_object(wPtr, index);
-
- h_ctl_hndl = (**w_objs_hndl).myHCntrlHdl;
- v_ctl_hndl = (**w_objs_hndl).myVCntrlHdl;
-
- if(is_activate)
- {
- if(h_ctl_hndl != NIL) ShowControl(h_ctl_hndl);
- if(v_ctl_hndl != NIL) ShowControl(v_ctl_hndl);
- DrawControls(wPtr);
- }
- else
- {
- if(h_ctl_hndl != NIL) HideControl(h_ctl_hndl);
- if(v_ctl_hndl != NIL) HideControl(v_ctl_hndl);
- }
-
- HLock((Handle)h_ctl_hndl); /* this line of code authored */
- /* by J. C. Ullrey to cure */
- /* a serious bug */
- bounds = (**h_ctl_hndl).contrlRect;
- ValidRect(&bounds);
- HUnlock((Handle)h_ctl_hndl); /* this line of code authored */
- /* by J. C. Ullrey to cure */
- /* a serious bug */
-
- HLock((Handle)v_ctl_hndl); /* this line of code authored */
- /* by J. C. Ullrey to cure */
- /* a serious bug */
- bounds = (**v_ctl_hndl).contrlRect;
- ValidRect(&bounds);
- HUnlock((Handle)v_ctl_hndl); /* this line of code authored */
- /* by J. C. Ullrey to cure */
- /* a serious bug */
-
-
- }
- if(!(**w_objs_hndl).isPrey)
- {
- InvalRect(&gPalette_frame); /* I-291 */
-
- /* draw_palette(wPtr); <- code replaced */
- /* by InvalRect() */
-
- /* If the window's update rgn is empty */
- /* this action triggers an update event */
- /* so that the palette is redrawn. */
- /* If the window's update rgn is not */
- /* empty, the palette area is simply */
- /* added to the update region, and is */
- /* redrawn. The palette is now redrawn */
- /* by the update routine, not by the */
- /* activate routine. This eliminates */
- /* the double drawing of the palette */
- /* when the windows are brought forward.*/
- }
-
- DrawGrowIcon(wPtr);
- }
-
- else if( wPtr == gRotateBox )
- {
- InvalRect(&gRotation_frame);
- InvalRect(&gDoManyRotation_box);
- InvalRect(&gMovement_frame);
- InvalRect(&gPlaneControl_frame);
- }
- else if( wPtr == gStretchBox )
- {
- InvalRect(&gStretch_frame);
- }
- /*break;*/ /* located in EventLoop.c */
- return;
-
- } /* end of do_activate */
-